
package com.naza.rpc.netty.handler;

import com.naza.rpc.netty.RpcReceiveHandler;
import com.naza.rpc.serialize.protostuff.ProtostuffCodecUtil;
import com.naza.rpc.serialize.protostuff.ProtostuffDecoder;
import com.naza.rpc.serialize.protostuff.ProtostuffEncoder;
import io.netty.channel.ChannelPipeline;

import java.util.Map;

/**
 * RPC服务端 Protostuff 编解码 处理(RpcReceiveHandler)
 * 
 * @author yl
 */
public class ProtostuffRecvHandler implements NazaRecvHandler {
    @Override
    public void handle(Map<String, Object> handlerMap, ChannelPipeline pipeline) {
        ProtostuffCodecUtil util = new ProtostuffCodecUtil();
        util.setRpcDirect(true);
        pipeline.addLast(new ProtostuffEncoder(util));
        pipeline.addLast(new ProtostuffDecoder(util));
        pipeline.addLast(new RpcReceiveHandler(handlerMap));
    }
}
